package com.gdth.bank.presenter;

import java.util.List;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

import com.gdth.bank.model.TXtBmModel;
import com.gdth.bank.view.TXtBmView;
import com.gdth.database.bean.TXtBm;

public class TXtBmPresenter implements IBasePresenter{
	public int update_login = 101;
	private TXtBmView mTXtBmView;
    private TXtBmModel mTXtBmModel;
    public TXtBmPresenter(TXtBmView mTXtBmView) {
        this.mTXtBmView = mTXtBmView;
        mTXtBmModel = new TXtBmModel();
    }
    
  public void getAllBm(String val){
		mTXtBmModel.getAllBm(val)
			.subscribeOn(Schedulers.io())
			.unsubscribeOn(Schedulers.io())
			.observeOn(AndroidSchedulers.mainThread())
			.subscribe(new Subscriber<List<TXtBm>>(){

				@Override
				public void onCompleted() {
					// TODO Auto-generated method stub
					mTXtBmView.hideProgressDialog();
				}
	
				@Override
				public void onError(Throwable arg0) {
					// TODO Auto-generated method stub
					//System.out.println(arg0);
				}
	
				@Override
				public void onNext(List<TXtBm> arg0) {
					// TODO Auto-generated method stub
					mTXtBmView.updateListBm(arg0);
				}
		});
    }
	@Override
	public void subscribe() {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void unsubscribe() {
		// TODO Auto-generated method stub
		
	}
}
